#include <stdio.h>

int countDigit(int target) {
    int result = 0;
    while (target) {
        result += target % 10;
        target /= 10;
    }
    return result;
}

int main() {
    int result = 0;
    int target;
    scanf("%d", &target);
    while (target % countDigit(target) == 0 && countDigit(target) != 1) {
        target /= countDigit(target);
        result++;
    }
    printf("%d", result);
    return 0;
}